package com.moleq.test;

import com.moleq.mgpos.activities.R;

import android.content.Context;
import android.view.Gravity;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;


public class TextImageView extends LinearLayout {
	private ImageView mImage;

	private TextView mTitle;

	public TextImageView(Context context, String title, int resId) {
		super(context);

		this.setOrientation(HORIZONTAL);
		this.setBackgroundResource(R.drawable.round_button);

		// Here we build the child views in code. They could also have
		// been specified in an XML file.

		mImage = new ImageView(context);
		mImage.setImageResource(resId);
		addView(mImage, new LinearLayout.LayoutParams(
				android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
				android.view.ViewGroup.LayoutParams.WRAP_CONTENT));// width
		// height

		mTitle = new TextView(context);
		mTitle.setText(title);
		mTitle.setGravity(Gravity.CENTER);
		addView(mTitle, new LinearLayout.LayoutParams(
				android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
				android.view.ViewGroup.LayoutParams.WRAP_CONTENT));

	}

	public void setImage(int resId) {
		mImage.setImageResource(resId);
	}

	/**
	 * Convenience method to set the title of a SpeechView
	 */
	public void setTitle(String title) {
		mTitle.setText(title);
	}
}
